#pragma once
#include <QGLWidget>
#include <QBrush>
#include <QFont>
#include <QPen>
#include <QWidget>
#include "graph.h"

class RenderWidget : public QGLWidget {
     Q_OBJECT

 public:
	RenderWidget(QWidget *parent, Graph* graph);
	~RenderWidget(void);

public slots:

public:
	void	setBackgroundImage(QString path);
	void	setBackgroundColor(QColor color);
	void	setNodeProperties(double radius, QColor fillColor, QColor lineColor, double lineWidth);
	void	setEdgeProperties(QColor lineColor, double lineWidth);
	
	void	useBackground(bool set) {visibleBackgroundImage = set;};
	void	drawNodes(bool draw) {visibleNodes = draw;};
	void	drawEdges(bool draw) {visibleEdges = draw;};
	void	wrapEdges(bool w) {wrap = w;};
protected:
	void	mouseMoveEvent(QMouseEvent *event);
	void	resizeEvent(QResizeEvent* event);
	void	paintEvent(QPaintEvent *event);
	void	paint(QPainter *painter, QPaintEvent *event);
	QPoint	getWindowCoordinate(QPointF point);
private:

	QString	backgroundImagePath;
	bool	visibleBackgroundImage;
	bool	visibleNodes;
	bool	visibleEdges;
	bool	wrap;

	QPixmap	backgroundImage;
	QBrush	background;

	/* Node properties */
	QBrush	nodeBrush;
	QPen	nodePen;
	double	nodeRadius;

	/* Edge properties */
	QPen	edgePen;

	Graph*	graph;
 };
